﻿using System;
using System.Diagnostics;

namespace Rhizome.Contract
{
#if !SILVERLIGHT && !WINDOWS_PHONE
    [Serializable]
#endif
    public sealed class EdgeNotFoundException<TState> : RhizomeException, IEdgeNotFoundException
    {
        public EdgeNotFoundException(TState state, object @event, Exception innerException)
            : base(string.Format("Edge not found. State: [{0}], Event: [{1}]", state, @event), innerException)
        {
            State = state;
            Event = @event;
        }

        public EdgeNotFoundException(TState state, object @event) : this(state, @event, null)
        {
        }

        public TState State { get; private set; }
        public object Event { get; private set; }

        #region IEdgeNotFoundException Members

        object IEdgeNotFoundException.State
        {
            [DebuggerStepThrough]
            get { return State; }
        }

        object IEdgeNotFoundException.Event
        {
            [DebuggerStepThrough]
            get { return Event; }
        }

        #endregion
    }

    public interface IEdgeNotFoundException
    {
        object State { get; }
        object Event { get; }
    }
}